use crossbeam::channel;
use std::thread;
fn main() {
    let (tx, rx) = channel::unbounded();
    // 多消费者
    for i in 0..5 {
        let rx_clone = rx.clone();
        thread::spawn(move || {
            while let Ok(message) = rx_clone.recv(){
                println!("Thread id {} got: {}", i, message);
            }
        });
    }

    // 单生产者
    for i in 0..5{
        tx.send(format!("Message {}", i)).unwrap();
    }
}